﻿@using Kevin.Shop.Business.SalesManagement.Enumerations
@using RiderShop.Mobile.Common.Component
@using Kevin.Shop.Business.SalesManagement.Components.Order
@model RiderShop.Mobile.Modle.MyAccount.OrderModel
@{
    Layout = "../Shared/_MobileLayout.cshtml";
}
@section header
{
    <link href="~/Themes/Common/Style/commom/jquery.mobile.structure-1.3.2.min.css" rel="stylesheet" media="all" ice:classes="*" />
    <style>
        .myAccountActive {
            color: #ff6c1f;
        }
    </style>

}
@section title
{
    我的订单
}
@section pagetitle
{
    我的订单
}
<div class="userCenterHeader">
    <span class="iconWrapper">
        <img src="~/Themes/RongJi/Style/base/imgs/icon_zhang.png">
    </span>
    <h3>我的订单@(string.IsNullOrEmpty(Request.QueryString["orderStatus"]) ? "" : " - " + ((Kevin.Shop.Business.SalesManagement.Enumerations.OrderStatus)int.Parse(Request.QueryString["orderStatus"])).ToString())</h3>
    <br class="clearfix">
</div>
<div class="box">
    <div class="btn-group btn-group-justified" role="group" aria-label="...">
        <a role="button" class="btn @(String.IsNullOrEmpty(Request.QueryString["orderType"]) || Request.QueryString["orderType"] == "1" ? "btn-warning" : "btn-default")" href="?orderType=1">近一月订单</a>
        <a role="button" class="btn @(Request.QueryString["orderType"] == "2" ? "btn-warning" : "btn-default")" href="?orderType=2">一月前订单</a>
        <a role="button" class="btn @(Request.QueryString["orderType"] == "3" ? "btn-warning" : "btn-default")" href="?orderType=3">已取消订单</a>
    </div>

    <div class="OrderPanel ">
        <div id="myTabContent" class="tab-content Order-tab-content">

            @foreach (var order in (Model.OrderList as List<OrderBasicInfo>))
            {
                <div id="order" class="tab-pane fade active in">

                    <div class="groupbox">
                        <div class="OtherTitle orderListHeader">
                            <div class="TitleLeft">
                                <h5 class="mt20">订单:@order.OrderNumber</h5>
                            </div>
                            <div class="TitleRight  mr5 mt10">
                                <a class="btn btn-success" href="~/MyAccount/OrderDetail?orderNumber=@order.OrderNumber">详细信息</a>
                                @if (@order.OrderStatus == OrderStatus.待支付)
                                {
                                    @*if (Request.UserAgent.Contains("MicroMessenger") && !string.IsNullOrEmpty(order.PaymentGateway) && order.PaymentGateway.ToUpper() == "WEIXINPAY")
                                        {
                                            <a class="btn btn-success btn-block mt20" href="@(string.Format(System.Configuration.ConfigurationManager.AppSettings["WeixinPayAddress"], order.OrderNumber.Trim()))" data-theme="a" data-role="button">微信支付</a>
                                        }
                                        else if (!string.IsNullOrEmpty(order.PaymentGateway) && order.PaymentGateway.ToUpper() == "RONGJICART")
                                        {
                                            <a class="btn btn-danger btn-block mt20" href="~/Purchase/YinxinPay?orderNumber=@order.OrderNumber.Trim()&orderType=1" data-theme="a" data-role="button">鲜享卡付款</a>
                                        }
                                        else
                                        {
                                            <a class="btn btn-danger btn-block mt20" href="~/Purchase/Payment?orderNumber=@order.OrderNumber.Trim()&orderType=1" data-theme="a" data-role="button">支付宝付款</a>
                                        }*@

                                    <a class="btn btn-danger btn-block mt20" href="@("/Purchase/OrderCompleted?par=" + @order.OrderNumber.Trim() + ",100,0&payonly=1")" data-the a" data-role="button">立即付款</a>
                                }
                                @if (@order.OrderType == 6 && order.OrderStatus == OrderStatus.已付款 && order.RegionId <= 0)
                                {
                                    <a class="btn btn-danger btn-block mt20" href="~/Purchase/PaymentCompleted?orderNumber=@order.OrderNumber.Trim()&orderType=6" data-theme="a" data-role="button">送朋友</a>
                                }
                            </div>
                        </div>
                        <div class="ItemTable">
                            <div class="ItemTableRight">
                                <div class="OtherProductItem" id="OtherProductRight">
                                    <a href="~/MyAccount/OrderDetail?orderNumber=@order.OrderNumber" class="ui-link">
                                        <div>
                                            <div class="mb5">
                                                <ul id="orderListTitle">
                                                    <li class="mb5">
                                                        <span class="tit">状态：</span><span class="info red fontweight">@order.OrdeStatusName</span>
                                                    </li>
                                                    <li class="mb5">
                                                        <span class="tit">下单日期：</span><span class="info">@order.OrderDate</span>
                                                    </li>
                                                </ul>
                                            </div>
                                            <table class="ordertable">
                                                <thead>
                                                    <tr>
                                                        <th></th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <tr>
                                                        <td class="textoverhid">
                                                            <span class="tit">数量</span>
                                                            <span class="ml10 mr10 fontweight">x</span>
                                                            <span class="mr10 orderListPrdNameTitle">商品名称</span>
                                                        </td>
                                                    </tr>
                                                    @foreach (var product in order.ProductList)
                                                    {
                                                        <tr>
                                                            <td class="textoverhid">
                                                                <span class="orderPrdInfo">@product.Quantity</span>
                                                                <span class=" ml10 mr10 orderPrdInfo fontweight">x</span>
                                                                <span class="ml5 textoverhid orderListPrdName">@product.ProductName</span>
                                                            </td>
                                                        </tr>
                                                    }

                                                </tbody>
                                            </table>
                                        </div>
                                    </a>
                                </div>
                                <div class="ProductPrice">订单金额：<span class="f15 fontweight">￥@order.OrderPayAmount</span> </div>
                            </div>
                        </div>
                    </div>


                </div>
            }

        </div>
        <div>
            @Html.Pagination(Kevin.Shop.Business.Service.Entity.Helper.WebClientContext.CON_PageSize, String.IsNullOrEmpty(Request.QueryString["page"]) ? 0 : int.Parse(Request.QueryString["page"]), Model.OrderTotlaCount, null)
        </div>
    </div>
</div>
@section footer
{
    <script>
        $(function () {
            //让toolbar选中
            var $homeImg = $("#homeImg");
            var $categoryImg = $("#categoryImg");
            var $myaccountImg = $("#myaccountImg");
            var $searchImg = $("#searchImg");

            $homeImg.attr("src", "/Themes/RongJi/Style/base/imgs/f10.png");
            $categoryImg.attr("src", "/Themes/RongJi/Style/base/imgs/f2.png");
            $myaccountImg.attr("src", "/Themes/RongJi/Style/base/imgs/f3_c.png");
            $searchImg.attr("src", "/Themes/RongJi/Style/base/imgs/f4.png");
        });
    </script>
}